package com.atguigu.gmall.mq.controller;

import com.atguigu.gmall.common.result.Result;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 李旭
 * @Time: 15:45
 * @Description:
 *
 * 发消息
 */
@RestController
@RequestMapping("/api/mq")
public class MqSendController {

    @Autowired
    private RabbitTemplate rabbitTemplate;
    //发消息
    @GetMapping("/sendMessage")
    public Result sendMessage(String message){

        rabbitTemplate.convertAndSend("exchange111","routingKey","1111");
        return Result.ok();
    }
}
